home *** CD-ROM | disk | FTP | other *** search
/ QuickTime 2.0 Beta / Quicktime 2.0 Beta.iso / Programming Stuff / Interfaces / Universal Interfaces / AppleEvents.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-01-30  |  31.3 KB  |  807 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        AppleEvents.h
  3.  
  4.     Copyright:    © 1984-1993 by Apple Computer, Inc., all rights reserved.
  5.  
  6.     WARNING
  7.     This file was auto generated by the interfacer tool. Modifications
  8.     must be made to the master file.
  9.  
  10. */
  11.  
  12. #ifndef __APPLEEVENTS__
  13. #define __APPLEEVENTS__
  14.  
  15. #ifndef __TYPES__
  16. #include <Types.h>
  17. /*    #include <ConditionalMacros.h>                                */
  18. /*    #include <MixedMode.h>                                        */
  19. /*        #include <Traps.h>                                        */
  20. #endif
  21.  
  22. #ifndef __MEMORY__
  23. #include <Memory.h>
  24. #endif
  25.  
  26. #ifndef __OSUTILS__
  27. #include <OSUtils.h>
  28. #endif
  29.  
  30. #ifndef __EVENTS__
  31. #include <Events.h>
  32. /*    #include <Quickdraw.h>                                        */
  33. /*        #include <QuickdrawText.h>                                */
  34. /*            #include <IntlResources.h>                            */
  35. #endif
  36.  
  37. #ifndef __EPPC__
  38. #include <EPPC.h>
  39. /*    #include <PPCToolBox.h>                                        */
  40. /*        #include <AppleTalk.h>                                    */
  41. /*    #include <Processes.h>                                        */
  42. /*        #include <Files.h>                                        */
  43. /*            #include <SegLoad.h>                                */
  44. #endif
  45.  
  46. #ifndef __NOTIFICATION__
  47. #include <Notification.h>
  48. #endif
  49.  
  50.  
  51. /*--------------------------------------------------------------
  52.         Apple event descriptor types
  53. --------------------------------------------------------------*/
  54.  
  55. #define typeBoolean 'bool'
  56.  
  57. #define typeChar 'TEXT'
  58.  
  59. #define typeSMInt 'shor'
  60.  
  61. #define typeInteger 'long'
  62.  
  63. #define typeSMFloat 'sing'
  64.  
  65. #define typeFloat 'doub'
  66.  
  67. #define typeLongInteger 'long'
  68.  
  69. #define typeShortInteger 'shor'
  70.  
  71. #define typeLongFloat 'doub'
  72.  
  73. #define typeShortFloat 'sing'
  74.  
  75. #define typeExtended 'exte'
  76.  
  77. #define typeComp 'comp'
  78.  
  79. #define typeMagnitude 'magn'
  80.  
  81. #define typeAEList 'list'
  82.  
  83. #define typeAERecord 'reco'
  84.  
  85. #define typeAppleEvent 'aevt'
  86.  
  87. #define typeTrue 'true'
  88.  
  89. #define typeFalse 'fals'
  90.  
  91. #define typeAlias 'alis'
  92.  
  93. #define typeEnumerated 'enum'
  94.  
  95. #define typeType 'type'
  96.  
  97. #define typeAppParameters 'appa'
  98.  
  99. #define typeProperty 'prop'
  100.  
  101. #define typeFSS 'fss '
  102.  
  103. #define typeKeyword 'keyw'
  104.  
  105. #define typeSectionH 'sect'
  106.  
  107. #define typeWildCard '****'
  108.  
  109. #define typeApplSignature 'sign'
  110.  
  111. #define typeSessionID 'ssid'
  112.  
  113. #define typeTargetID 'targ'
  114.  
  115. #define typeProcessSerialNumber 'psn '
  116.  
  117. #define typeNull 'null'
  118.  
  119.  
  120. /*--------------------------------------------------------------
  121.         Keywords for Apple event parameters
  122. --------------------------------------------------------------*/
  123.  
  124. #define keyDirectObject '----'
  125.  
  126. #define keyErrorNumber 'errn'
  127.  
  128. #define keyErrorString 'errs'
  129.  
  130. #define keyProcessSerialNumber 'psn '
  131.  
  132.  
  133. /*--------------------------------------------------------------
  134.         Keywords for Apple event attributes
  135. --------------------------------------------------------------*/
  136.  
  137. #define keyTransactionIDAttr 'tran'
  138.  
  139. #define keyReturnIDAttr 'rtid'
  140.  
  141. #define keyEventClassAttr 'evcl'
  142.  
  143. #define keyEventIDAttr 'evid'
  144.  
  145. #define keyAddressAttr 'addr'
  146.  
  147. #define keyOptionalKeywordAttr 'optk'
  148.  
  149. #define keyTimeoutAttr 'timo'
  150.  
  151. #define keyInteractLevelAttr 'inte'
  152.  
  153. #define keyEventSourceAttr 'esrc'
  154.  
  155. #define keyMissedKeywordAttr 'miss'
  156.  
  157. #define keyOriginalAddressAttr 'from'
  158.  
  159.  
  160. /*--------------------------------------------------------------
  161.         Keywords for special handlers
  162. --------------------------------------------------------------*/
  163.  
  164. #define keyPreDispatch 'phac'
  165.  
  166. #define keySelectProc 'selh'
  167.  
  168.  
  169. /*--------------------------------------------------------------
  170.         Keyword for recording
  171. --------------------------------------------------------------*/
  172.  
  173. #define keyAERecorderCount 'recr'
  174.  
  175.  
  176. /*--------------------------------------------------------------
  177.         Keyword for version information
  178. --------------------------------------------------------------*/
  179.  
  180. #define keyAEVersion 'vers'
  181.  
  182.  
  183. /*--------------------------------------------------------------
  184.         Event Class
  185. --------------------------------------------------------------*/
  186.  
  187. #define kCoreEventClass 'aevt'
  188.  
  189.  
  190. /*--------------------------------------------------------------
  191.         Event ID's
  192. --------------------------------------------------------------*/
  193.  
  194. #define kAEOpenApplication 'oapp'
  195.  
  196. #define kAEOpenDocuments 'odoc'
  197.  
  198. #define kAEPrintDocuments 'pdoc'
  199.  
  200. #define kAEQuitApplication 'quit'
  201.  
  202. #define kAEAnswer 'ansr'
  203.  
  204. #define kAEApplicationDied 'obit'
  205.  
  206.  
  207. /*--------------------------------------------------------------
  208.         Constants for use in AESend mode
  209. --------------------------------------------------------------*/
  210.  
  211. enum  {
  212.     kAENoReply                    = 0x00000001,                    /* sender doesn't want a reply to event */
  213.     kAEQueueReply                = 0x00000002,                    /* sender wants a reply but won't wait */
  214.     kAEWaitReply                = 0x00000003,                    /* sender wants a reply and will wait */
  215.     kAENeverInteract            = 0x00000010,                    /* server should not interact with user */
  216.     kAECanInteract                = 0x00000020,                    /* server may try to interact with user */
  217.     kAEAlwaysInteract            = 0x00000030,                    /* server should always interact with user where appropriate */
  218.     kAECanSwitchLayer            = 0x00000040,                    /* interaction may switch layer */
  219.     kAEDontReconnect            = 0x00000080,                    /* don't reconnect if there is a sessClosedErr from PPCToolbox */
  220.     kAEWantReceipt                = nReturnReceipt,                /* sender wants a receipt of message */
  221.     kAEDontRecord                = 0x00001000,                    /* don't record this event - available only in vers 1.0.1 and greater */
  222.     kAEDontExecute                = 0x00002000,                    /* don't send the event for recording - available only in vers 1.0.1 and greater */
  223. /*--------------------------------------------------------------
  224.         Constants for the send priority in AESend
  225. --------------------------------------------------------------*/
  226.     kAENormalPriority            = 0x00000000,                    /* post message at the end of the event queue */
  227.     kAEHighPriority                = nAttnMsg                        /* post message at the front of the event queue */
  228. };
  229.  
  230.  
  231. /*--------------------------------------------------------------
  232.         Constants for recording
  233. --------------------------------------------------------------*/
  234.  
  235. #define kAEStartRecording 'reca'
  236.  
  237. #define kAEStopRecording 'recc'
  238.  
  239. #define kAENotifyStartRecording 'rec1'
  240.  
  241. #define kAENotifyStopRecording 'rec0'
  242.  
  243. #define kAENotifyRecording 'recr'
  244.  
  245.  
  246. /*--------------------------------------------------------------
  247.         Constant for the returnID param of AECreateAppleEvent
  248. --------------------------------------------------------------*/
  249.  
  250. enum  {
  251.     kAutoGenerateReturnID        = -1,                            /* AECreateAppleEvent will generate a session-unique ID */
  252. /*--------------------------------------------------------------
  253.         Constant for transaction ID's
  254. --------------------------------------------------------------*/
  255.     kAnyTransactionID            = 0,                            /* no transaction is in use */
  256. /*--------------------------------------------------------------
  257.         Constants for timeout durations
  258. --------------------------------------------------------------*/
  259.     kAEDefaultTimeout            = -1,                            /* timeout value determined by AEM */
  260.     kNoTimeOut                    = -2                            /* wait until reply comes back, however long it takes */
  261. };
  262.  
  263.  
  264. /*--------------------------------------------------------------
  265.         Constants for AEResumeTheCurrentEvent
  266. --------------------------------------------------------------*/
  267.  
  268. enum  {
  269.     kAENoDispatch                = 0,                            /* dispatch parameter to AEResumeTheCurrentEvent takes a pointer to a dispatch */
  270.     kAEUseStandardDispatch        = 0xFFFFFFFF,                    /* table, or one of these two constants */
  271. /*--------------------------------------------------------------
  272.         Constants for Refcon in AEResumeTheCurrentEvent with kAEUseStandardDispatch
  273. --------------------------------------------------------------*/
  274.     kAEDoNotIgnoreHandler        = 0x00000000,
  275.     kAEIgnoreAppPhacHandler        = 0x00000001,                    /* available only in vers 1.0.1 and greater */
  276.     kAEIgnoreAppEventHandler    = 0x00000002,                    /* available only in vers 1.0.1 and greater */
  277.     kAEIgnoreSysPhacHandler        = 0x00000004,                    /* available only in vers 1.0.1 and greater */
  278.     kAEIgnoreSysEventHandler    = 0x00000008,                    /* available only in vers 1.0.1 and greater */
  279.     kAEIngoreBuiltInEventHandler = 0x00000010,                    /* available only in vers 1.0.1 and greater */
  280.     kAEDontDisposeOnResume        = 0x80000000                    /* available only in vers 1.0.1 and greater */
  281. };
  282.  
  283.  
  284. /*--------------------------------------------------------------
  285.         Apple event manager data types
  286. --------------------------------------------------------------*/
  287.  
  288. typedef unsigned long AEEventClass;
  289.  
  290. typedef unsigned long AEEventID;
  291.  
  292. typedef unsigned long AEKeyword;
  293.  
  294. typedef ResType DescType;
  295.  
  296. #if defined(powerc) || defined (__powerc)
  297. #pragma options align=mac68k
  298. #endif
  299. struct AEDesc {
  300.     DescType                    descriptorType;
  301.     Handle                        dataHandle;
  302. };
  303. #if defined(powerc) || defined(__powerc)
  304. #pragma options align=reset
  305. #endif
  306.  
  307. typedef struct AEDesc AEDesc;
  308.  
  309. #if defined(powerc) || defined (__powerc)
  310. #pragma options align=mac68k
  311. #endif
  312. struct AEKeyDesc {
  313.     AEKeyword                    descKey;
  314.     AEDesc                        descContent;
  315. };
  316. #if defined(powerc) || defined(__powerc)
  317. #pragma options align=reset
  318. #endif
  319.  
  320. typedef struct AEKeyDesc AEKeyDesc;
  321.  
  322.  
  323. /* an AEDesc which contains address data */
  324.  
  325. typedef AEDesc AEAddressDesc;
  326.  
  327.  
  328. /* a list of AEDesc's is a special kind of AEDesc */
  329.  
  330. typedef AEDesc AEDescList;
  331.  
  332.  
  333. /* AERecord is a list of keyworded AEDesc's */
  334.  
  335. typedef AEDescList AERecord;
  336.  
  337.  
  338. /* an AERecord that contains an AppleEvent */
  339.  
  340. typedef AERecord AppleEvent;
  341.  
  342.  
  343. /* parameter to AESend */
  344.  
  345. typedef long AESendMode;
  346.  
  347.  
  348. /* priority param of AESend */
  349.  
  350. typedef short AESendPriority;
  351.  
  352. enum  {
  353.     kAEInteractWithSelf,
  354.     kAEInteractWithLocal,
  355.     kAEInteractWithAll
  356. };
  357.  
  358. typedef unsigned char AEInteractAllowed;
  359.  
  360. enum  {
  361.     kAEUnknownSource,
  362.     kAEDirectCall,
  363.     kAESameProcess,
  364.     kAELocalProcess,
  365.     kAERemoteProcess
  366. };
  367.  
  368. typedef unsigned char AEEventSource;
  369.  
  370. enum  {
  371.     kAEDataArray,
  372.     kAEPackedArray,
  373.     kAEHandleArray,
  374.     kAEDescArray,
  375.     kAEKeyDescArray
  376. };
  377.  
  378. typedef unsigned char AEArrayType;
  379.  
  380. #if defined(powerc) || defined (__powerc)
  381. #pragma options align=mac68k
  382. #endif
  383. union AEArrayData {
  384.     short                        kAEDataArray[1];
  385.     char                        kAEPackedArray[1];
  386.     Handle                        kAEHandleArray[1];
  387.     AEDesc                        kAEDescArray[1];
  388.     AEKeyDesc                    kAEKeyDescArray[1];
  389. };
  390. #if defined(powerc) || defined(__powerc)
  391. #pragma options align=reset
  392. #endif
  393.  
  394. typedef union AEArrayData AEArrayData;
  395.  
  396. typedef AEArrayData *AEArrayDataPointer;
  397.  
  398. typedef pascal Boolean (*AEIdleProcPtr)(EventRecord *theEvent, long *sleepTime, RgnHandle *mouseRgn);
  399.  
  400. enum {
  401.     uppAEIdleProcInfo = kPascalStackBased
  402.          | RESULT_SIZE(SIZE_CODE(sizeof(Boolean)))
  403.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(EventRecord*)))
  404.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(long*)))
  405.          | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(RgnHandle*)))
  406. };
  407.  
  408. #if USESROUTINEDESCRIPTORS
  409. typedef UniversalProcPtr AEIdleUPP;
  410.  
  411. #define CallAEIdleProc(userRoutine, theEvent, sleepTime, mouseRgn)        \
  412.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppAEIdleProcInfo, (theEvent), (sleepTime), (mouseRgn))
  413. #define NewAEIdleProc(userRoutine)        \
  414.         (AEIdleUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppAEIdleProcInfo, GetCurrentISA())
  415. #else
  416. typedef AEIdleProcPtr AEIdleUPP;
  417.  
  418. #define CallAEIdleProc(userRoutine, theEvent, sleepTime, mouseRgn)        \
  419.         (*(userRoutine))((theEvent), (sleepTime), (mouseRgn))
  420. #define NewAEIdleProc(userRoutine)        \
  421.         (AEIdleUPP)(userRoutine)
  422. #endif
  423.  
  424. typedef pascal Boolean (*AEFilterProcPtr)(EventRecord *theEvent, long returnID, long transactionID, const AEAddressDesc *sender);
  425.  
  426. enum {
  427.     uppAEFilterProcInfo = kPascalStackBased
  428.          | RESULT_SIZE(SIZE_CODE(sizeof(Boolean)))
  429.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(EventRecord*)))
  430.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(long)))
  431.          | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(long)))
  432.          | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(AEAddressDesc*)))
  433. };
  434.  
  435. #if USESROUTINEDESCRIPTORS
  436. typedef UniversalProcPtr AEFilterUPP;
  437.  
  438. #define CallAEFilterProc(userRoutine, theEvent, returnID, transactionID, sender)        \
  439.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppAEFilterProcInfo, (theEvent), (returnID), (transactionID), (sender))
  440. #define NewAEFilterProc(userRoutine)        \
  441.         (AEFilterUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppAEFilterProcInfo, GetCurrentISA())
  442. #else
  443. typedef AEFilterProcPtr AEFilterUPP;
  444.  
  445. #define CallAEFilterProc(userRoutine, theEvent, returnID, transactionID, sender)        \
  446.         (*(userRoutine))((theEvent), (returnID), (transactionID), (sender))
  447. #define NewAEFilterProc(userRoutine)        \
  448.         (AEFilterUPP)(userRoutine)
  449. #endif
  450.  
  451. typedef pascal OSErr (*AEEventHandlerProcPtr)(const AppleEvent *theAppleEvent, AppleEvent *reply, long handlerRefcon);
  452.  
  453. enum {
  454.     uppAEEventHandlerProcInfo = kPascalStackBased
  455.          | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  456.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(AppleEvent*)))
  457.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(AppleEvent*)))
  458.          | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(long)))
  459. };
  460.  
  461. #if USESROUTINEDESCRIPTORS
  462. typedef UniversalProcPtr AEEventHandlerUPP;
  463.  
  464. #define CallAEEventHandlerProc(userRoutine, theAppleEvent, reply, handlerRefcon)        \
  465.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppAEEventHandlerProcInfo, (theAppleEvent), (reply), (handlerRefcon))
  466. #define NewAEEventHandlerProc(userRoutine)        \
  467.         (AEEventHandlerUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppAEEventHandlerProcInfo, GetCurrentISA())
  468. #else
  469. typedef AEEventHandlerProcPtr AEEventHandlerUPP;
  470.  
  471. #define CallAEEventHandlerProc(userRoutine, theAppleEvent, reply, handlerRefcon)        \
  472.         (*(userRoutine))((theAppleEvent), (reply), (handlerRefcon))
  473. #define NewAEEventHandlerProc(userRoutine)        \
  474.         (AEEventHandlerUPP)(userRoutine)
  475. #endif
  476.  
  477. typedef pascal OSErr (*AECoerceDescProcPtr)(const AEDesc *fromDesc, DescType toType, long handlerRefcon, AEDesc *toDesc);
  478.  
  479. enum {
  480.     uppAECoerceDescProcInfo = kPascalStackBased
  481.          | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  482.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(AEDesc*)))
  483.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(DescType)))
  484.          | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(long)))
  485.          | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(AEDesc*)))
  486. };
  487.  
  488. #if USESROUTINEDESCRIPTORS
  489. typedef UniversalProcPtr AECoerceDescUPP;
  490.  
  491. #define CallAECoerceDescProc(userRoutine, fromDesc, toType, handlerRefcon, toDesc)        \
  492.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppAECoerceDescProcInfo, (fromDesc), (toType), (handlerRefcon), (toDesc))
  493. #define NewAECoerceDescProc(userRoutine)        \
  494.         (AECoerceDescUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppAECoerceDescProcInfo, GetCurrentISA())
  495. #else
  496. typedef AECoerceDescProcPtr AECoerceDescUPP;
  497.  
  498. #define CallAECoerceDescProc(userRoutine, fromDesc, toType, handlerRefcon, toDesc)        \
  499.         (*(userRoutine))((fromDesc), (toType), (handlerRefcon), (toDesc))
  500. #define NewAECoerceDescProc(userRoutine)        \
  501.         (AECoerceDescUPP)(userRoutine)
  502. #endif
  503.  
  504. typedef pascal OSErr (*AECoercePtrProcPtr)(DescType typeCode, const void *dataPtr, Size dataSize, DescType toType, long handlerRefcon, AEDesc *result);
  505.  
  506. enum {
  507.     uppAECoercePtrProcInfo = kPascalStackBased
  508.          | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  509.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(DescType)))
  510.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(void*)))
  511.          | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(Size)))
  512.          | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(DescType)))
  513.          | STACK_ROUTINE_PARAMETER(5, SIZE_CODE(sizeof(long)))
  514.          | STACK_ROUTINE_PARAMETER(6, SIZE_CODE(sizeof(AEDesc*)))
  515. };
  516.  
  517. #if USESROUTINEDESCRIPTORS
  518. typedef UniversalProcPtr AECoercePtrUPP;
  519.  
  520. #define CallAECoercePtrProc(userRoutine, typeCode, dataPtr, dataSize, toType, handlerRefcon, result)        \
  521.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppAECoercePtrProcInfo, (typeCode), (dataPtr), (dataSize), (toType), (handlerRefcon), (result))
  522. #define NewAECoercePtrProc(userRoutine)        \
  523.         (AECoercePtrUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppAECoercePtrProcInfo, GetCurrentISA())
  524. #else
  525. typedef AECoercePtrProcPtr AECoercePtrUPP;
  526.  
  527. #define CallAECoercePtrProc(userRoutine, typeCode, dataPtr, dataSize, toType, handlerRefcon, result)        \
  528.         (*(userRoutine))((typeCode), (dataPtr), (dataSize), (toType), (handlerRefcon), (result))
  529. #define NewAECoercePtrProc(userRoutine)        \
  530.         (AECoercePtrUPP)(userRoutine)
  531. #endif
  532.  
  533. typedef UniversalProcPtr AECoercionHandlerUPP;
  534.  
  535.  
  536. /*--------------------------------------------------------------
  537.         Apple event manager error messages
  538. --------------------------------------------------------------*/
  539.  
  540. enum  {
  541.     errAECoercionFail            = -1700,                        /* bad parameter data or unable to coerce the data supplied */
  542.     errAEDescNotFound            = -1701,
  543.     errAECorruptData            = -1702,
  544.     errAEWrongDataType            = -1703,
  545.     errAENotAEDesc                = -1704,
  546.     errAEBadListItem            = -1705,                        /* the specified list item does not exist */
  547.     errAENewerVersion            = -1706,                        /* need newer version of the AppleEvent manager */
  548.     errAENotAppleEvent            = -1707,                        /* the event is not in AppleEvent format */
  549.     errAEEventNotHandled        = -1708,                        /* the AppleEvent was not handled by any handler */
  550.     errAEReplyNotValid            = -1709,                        /* AEResetTimer was passed an invalid reply parameter */
  551.     errAEUnknownSendMode        = -1710,                        /* mode wasn't NoReply, WaitReply, or QueueReply or Interaction level is unknown */
  552.     errAEWaitCanceled            = -1711,                        /* in AESend, the user cancelled out of wait loop for reply or receipt */
  553.     errAETimeout                = -1712,                        /* the AppleEvent timed out */
  554.     errAENoUserInteraction        = -1713,                        /* no user interaction is allowed */
  555.     errAENotASpecialFunction    = -1714,                        /* there is no special function for/with this keyword */
  556.     errAEParamMissed            = -1715,                        /* a required parameter was not accessed */
  557.     errAEUnknownAddressType        = -1716,                        /* the target address type is not known */
  558.     errAEHandlerNotFound        = -1717,                        /* no handler in the dispatch tables fits the parameters to AEGetEventHandler or AEGetCoercionHandler */
  559.     errAEReplyNotArrived        = -1718                            /* the contents of the reply you are accessing have not arrived yet */
  560. };
  561.  
  562. enum  {
  563.     errAEIllegalIndex            = -1719,                        /* index is out of range in a put operation */
  564.     errAEUnknownObjectType        = -1731,                        /* available only in version 1.0.1 or greater */
  565.     errAERecordingIsAlreadyOn    = -1732                            /* available only in version 1.0.1 or greater */
  566. };
  567.  
  568. #ifdef __cplusplus
  569. extern "C" {
  570. #endif
  571.  
  572.  
  573. /**************************************************************************
  574.  The following calls apply to any AEDesc. Every 'result' descriptor is
  575.  created for you, so you will be responsible for memory management
  576.  (including disposing) of the descriptors so created. Note: purgeable
  577.  descriptor data is not supported - the AEM does not call LoadResource.  
  578. **************************************************************************/
  579.  
  580. extern pascal OSErr AECreateDesc(DescType typeCode, const void *dataPtr, Size dataSize, AEDesc *result)
  581.  THREEWORDINLINE(0x303C, 0x0825, 0xA816);
  582. extern pascal OSErr AECoercePtr(DescType typeCode, const void *dataPtr, Size dataSize, DescType toType, AEDesc *result)
  583.  THREEWORDINLINE(0x303C, 0x0A02, 0xA816);
  584. extern pascal OSErr AECoerceDesc(const AEDesc *theAEDesc, DescType toType, AEDesc *result)
  585.  THREEWORDINLINE(0x303C, 0x0603, 0xA816);
  586. extern pascal OSErr AEDisposeDesc(AEDesc *theAEDesc)
  587.  THREEWORDINLINE(0x303C, 0x0204, 0xA816);
  588. extern pascal OSErr AEDuplicateDesc(const AEDesc *theAEDesc, AEDesc *result)
  589.  THREEWORDINLINE(0x303C, 0x0405, 0xA816);
  590.  
  591. /**************************************************************************
  592.   The following calls apply to AEDescList. Since AEDescList is a subtype of
  593.   AEDesc, the calls in the previous section can also be used for AEDescList.
  594.   All list and array indices are 1-based. If the data was greater than
  595.   maximumSize in the routines below, then actualSize will be greater than
  596.   maximumSize, but only maximumSize bytes will actually be retrieved.
  597. **************************************************************************/
  598.  
  599. extern pascal OSErr AECreateList(const void *factoringPtr, Size factoredSize, Boolean isRecord, AEDescList *resultList)
  600.  THREEWORDINLINE(0x303C, 0x0706, 0xA816);
  601. extern pascal OSErr AECountItems(const AEDescList *theAEDescList, long *theCount)
  602.  THREEWORDINLINE(0x303C, 0x0407, 0xA816);
  603. extern pascal OSErr AEPutPtr(const AEDescList *theAEDescList, long index, DescType typeCode, const void *dataPtr, Size dataSize)
  604.  THREEWORDINLINE(0x303C, 0x0A08, 0xA816);
  605. extern pascal OSErr AEPutDesc(const AEDescList *theAEDescList, long index, const AEDesc *theAEDesc)
  606.  THREEWORDINLINE(0x303C, 0x0609, 0xA816);
  607. extern pascal OSErr AEGetNthPtr(const AEDescList *theAEDescList, long index, DescType desiredType, AEKeyword *theAEKeyword, DescType *typeCode, void *dataPtr, Size maximumSize, Size *actualSize)
  608.  THREEWORDINLINE(0x303C, 0x100A, 0xA816);
  609. extern pascal OSErr AEGetNthDesc(const AEDescList *theAEDescList, long index, DescType desiredType, AEKeyword *theAEKeyword, AEDesc *result)
  610.  THREEWORDINLINE(0x303C, 0x0A0B, 0xA816);
  611. extern pascal OSErr AESizeOfNthItem(const AEDescList *theAEDescList, long index, DescType *typeCode, Size *dataSize)
  612.  THREEWORDINLINE(0x303C, 0x082A, 0xA816);
  613. extern pascal OSErr AEGetArray(const AEDescList *theAEDescList, AEArrayType arrayType, AEArrayDataPointer arrayPtr, Size maximumSize, DescType *itemType, Size *itemSize, long *itemCount)
  614.  THREEWORDINLINE(0x303C, 0x0D0C, 0xA816);
  615. extern pascal OSErr AEPutArray(const AEDescList *theAEDescList, AEArrayType arrayType, const AEArrayData *arrayPtr, DescType itemType, Size itemSize, long itemCount)
  616.  THREEWORDINLINE(0x303C, 0x0B0D, 0xA816);
  617. extern pascal OSErr AEDeleteItem(const AEDescList *theAEDescList, long index)
  618.  THREEWORDINLINE(0x303C, 0x040E, 0xA816);
  619.  
  620. /**************************************************************************
  621.  The following calls apply to AERecord. Since AERecord is a subtype of
  622.  AEDescList, the calls in the previous sections can also be used for
  623.  AERecord an AERecord can be created by using AECreateList with isRecord
  624.  set to true. 
  625.  
  626.  NOTE: These calls are duplicately named, so their implementation has
  627.  been changed to a macro which calls the duplicate function.
  628. **************************************************************************/
  629.  
  630. #define AEPutKeyPtr(theAERecord, theAEKeyword, typeCode, dataPtr, dataSize)  \
  631.     AEPutParamPtr((theAERecord), (theAEKeyword), (typeCode), (dataPtr), (dataSize))
  632.  
  633. #define AEPutKeyDesc(theAERecord, theAEKeyword, theAEDesc)  \
  634.     AEPutParamDesc((theAERecord), (theAEKeyword), (theAEDesc))
  635.  
  636. #define AEGetKeyPtr(theAERecord, theAEKeyword, desiredType, typeCode, dataPtr, maxSize, actualSize)  \
  637.     AEGetParamPtr((theAERecord), (theAEKeyword), (desiredType), (typeCode), (dataPtr), (maxSize), (actualSize))
  638.  
  639. #define AEGetKeyDesc(theAERecord, theAEKeyword, desiredType, result)  \
  640.     AEGetParamDesc((theAERecord), (theAEKeyword), (desiredType), (result))
  641.  
  642. #define AESizeOfKeyDesc(theAERecord, theAEKeyword, typeCode, dataSize)  \
  643.     AESizeOfParam((theAERecord), (theAEKeyword), (typeCode), (dataSize))
  644.  
  645. #define AEDeleteKeyDesc(theAERecord, theAEKeyword)  \
  646.     AEDeleteParam((theAERecord), (theAEKeyword))
  647.  
  648.  
  649. /**************************************************************************
  650.   The following calls are used to pack and unpack parameters from records
  651.   of type AppleEvent. Since AppleEvent is a subtype of AERecord, the calls
  652.   in the previous sections can also be used for variables of type
  653.   AppleEvent. The next six calls are in fact identical to the six calls
  654.   for AERecord.
  655. **************************************************************************/
  656.  
  657. extern pascal OSErr AEPutParamPtr(const AppleEvent *theAppleEvent, AEKeyword theAEKeyword, DescType typeCode, const void *dataPtr, Size dataSize)
  658.  THREEWORDINLINE(0x303C, 0x0A0F, 0xA816);
  659. extern pascal OSErr AEPutParamDesc(const AppleEvent *theAppleEvent, AEKeyword theAEKeyword, const AEDesc *theAEDesc)
  660.  THREEWORDINLINE(0x303C, 0x0610, 0xA816);
  661. extern pascal OSErr AEGetParamPtr(const AppleEvent *theAppleEvent, AEKeyword theAEKeyword, DescType desiredType, DescType *typeCode, void *dataPtr, Size maximumSize, Size *actualSize)
  662.  THREEWORDINLINE(0x303C, 0x0E11, 0xA816);
  663. extern pascal OSErr AEGetParamDesc(const AppleEvent *theAppleEvent, AEKeyword theAEKeyword, DescType desiredType, AEDesc *result)
  664.  THREEWORDINLINE(0x303C, 0x0812, 0xA816);
  665. extern pascal OSErr AESizeOfParam(const AppleEvent *theAppleEvent, AEKeyword theAEKeyword, DescType *typeCode, Size *dataSize)
  666.  THREEWORDINLINE(0x303C, 0x0829, 0xA816);
  667. extern pascal OSErr AEDeleteParam(const AppleEvent *theAppleEvent, AEKeyword theAEKeyword)
  668.  THREEWORDINLINE(0x303C, 0x0413, 0xA816);
  669.  
  670. /**************************************************************************
  671.  The following calls also apply to type AppleEvent. Message attributes are
  672.  far more restricted, and can only be accessed through the following 5
  673.  calls. The various list and record routines cannot be used to access the
  674.  attributes of an event. 
  675. **************************************************************************/
  676.  
  677. extern pascal OSErr AEGetAttributePtr(const AppleEvent *theAppleEvent, AEKeyword theAEKeyword, DescType desiredType, DescType *typeCode, void *dataPtr, Size maximumSize, Size *actualSize)
  678.  THREEWORDINLINE(0x303C, 0x0E15, 0xA816);
  679. extern pascal OSErr AEGetAttributeDesc(const AppleEvent *theAppleEvent, AEKeyword theAEKeyword, DescType desiredType, AEDesc *result)
  680.  THREEWORDINLINE(0x303C, 0x0826, 0xA816);
  681. extern pascal OSErr AESizeOfAttribute(const AppleEvent *theAppleEvent, AEKeyword theAEKeyword, DescType *typeCode, Size *dataSize)
  682.  THREEWORDINLINE(0x303C, 0x0828, 0xA816);
  683. extern pascal OSErr AEPutAttributePtr(const AppleEvent *theAppleEvent, AEKeyword theAEKeyword, DescType typeCode, const void *dataPtr, Size dataSize)
  684.  THREEWORDINLINE(0x303C, 0x0A16, 0xA816);
  685. extern pascal OSErr AEPutAttributeDesc(const AppleEvent *theAppleEvent, AEKeyword theAEKeyword, const AEDesc *theAEDesc)
  686.  THREEWORDINLINE(0x303C, 0x0627, 0xA816);
  687.  
  688. /**************************************************************************
  689.   The next couple of calls are basic routines used to create, send,
  690.   and process AppleEvents. 
  691. **************************************************************************/
  692.  
  693. extern pascal OSErr AECreateAppleEvent(AEEventClass theAEEventClass, AEEventID theAEEventID, const AEAddressDesc *target, short returnID, long transactionID, AppleEvent *result)
  694.  THREEWORDINLINE(0x303C, 0x0B14, 0xA816);
  695. extern pascal OSErr AESend(const AppleEvent *theAppleEvent, AppleEvent *reply, AESendMode sendMode, AESendPriority sendPriority, long timeOutInTicks, AEIdleUPP idleProc, AEFilterUPP filterProc)
  696.  THREEWORDINLINE(0x303C, 0x0D17, 0xA816);
  697. extern pascal OSErr AEProcessAppleEvent(const EventRecord *theEventRecord)
  698.  THREEWORDINLINE(0x303C, 0x021B, 0xA816);
  699.  
  700. /* 
  701.  Note: during event processing, an event handler may realize that it is likely
  702.  to exceed the client's timeout limit. Passing the reply to this
  703.  routine causes a wait event to be generated that asks the client
  704.  for more time. 
  705. */
  706.  
  707. extern pascal OSErr AEResetTimer(const AppleEvent *reply)
  708.  THREEWORDINLINE(0x303C, 0x0219, 0xA816);
  709.  
  710. /**************************************************************************
  711.  The following four calls are available for applications which need more
  712.  sophisticated control over when and how events are processed. Applications
  713.  which implement multi-session servers or which implement their own
  714.  internal event queueing will probably be the major clients of these
  715.  routines. They can be called from within a handler to prevent the AEM from
  716.  disposing of the AppleEvent when the handler returns. They can be used to
  717.  asynchronously process the event (as MacApp does).
  718. **************************************************************************/
  719.  
  720. extern pascal OSErr AESuspendTheCurrentEvent(const AppleEvent *theAppleEvent)
  721.  THREEWORDINLINE(0x303C, 0x022B, 0xA816);
  722.  
  723. /* 
  724.  Note: The following routine tells the AppleEvent manager that processing
  725.  is either about to resume or has been completed on a previously suspended
  726.  event. The procPtr passed in as the dispatcher parameter will be called to
  727.  attempt to redispatch the event. Several constants for the dispatcher
  728.  parameter allow special behavior. They are:
  729.       - kAEUseStandardDispatch means redispatch as if the event was just
  730.       received, using the standard AppleEvent dispatch mechanism.
  731.       - kAENoDispatch means ignore the parameter.
  732.          Use this in the case where the event has been handled and no
  733.       redispatch is needed.
  734.       - non nil means call the routine which the dispatcher points to.
  735. */
  736.  
  737. extern pascal OSErr AEResumeTheCurrentEvent(const AppleEvent *theAppleEvent, const AppleEvent *reply, AEEventHandlerUPP dispatcher, long handlerRefcon)
  738.  THREEWORDINLINE(0x303C, 0x0818, 0xA816);
  739. extern pascal OSErr AEGetTheCurrentEvent(AppleEvent *theAppleEvent)
  740.  THREEWORDINLINE(0x303C, 0x021A, 0xA816);
  741. extern pascal OSErr AESetTheCurrentEvent(const AppleEvent *theAppleEvent)
  742.  THREEWORDINLINE(0x303C, 0x022C, 0xA816);
  743.  
  744. /**************************************************************************
  745.   The following three calls are used to allow applications to behave
  746.   courteously when a user interaction such as a dialog box is needed. 
  747. **************************************************************************/
  748.  
  749. extern pascal OSErr AEGetInteractionAllowed(AEInteractAllowed *level)
  750.  THREEWORDINLINE(0x303C, 0x021D, 0xA816);
  751. extern pascal OSErr AESetInteractionAllowed(AEInteractAllowed level)
  752.  THREEWORDINLINE(0x303C, 0x011E, 0xA816);
  753. extern pascal OSErr AEInteractWithUser(long timeOutInTicks, NMRecPtr nmReqPtr, AEIdleUPP idleProc)
  754.  THREEWORDINLINE(0x303C, 0x061C, 0xA816);
  755.  
  756. /**************************************************************************
  757.   These calls are used to set up and modify the event dispatch table.
  758. **************************************************************************/
  759.  
  760. extern pascal OSErr AEInstallEventHandler(AEEventClass theAEEventClass, AEEventID theAEEventID, AEEventHandlerUPP handler, long handlerRefcon, Boolean isSysHandler)
  761.  THREEWORDINLINE(0x303C, 0x091F, 0xA816);
  762. extern pascal OSErr AERemoveEventHandler(AEEventClass theAEEventClass, AEEventID theAEEventID, AEEventHandlerUPP handler, Boolean isSysHandler)
  763.  THREEWORDINLINE(0x303C, 0x0720, 0xA816);
  764. extern pascal OSErr AEGetEventHandler(AEEventClass theAEEventClass, AEEventID theAEEventID, AEEventHandlerUPP *handler, long *handlerRefcon, Boolean isSysHandler)
  765.  THREEWORDINLINE(0x303C, 0x0921, 0xA816);
  766.  
  767. /**************************************************************************
  768.   These calls are used to set up and modify the coercion dispatch table.
  769. **************************************************************************/
  770.  
  771. extern pascal OSErr AEInstallCoercionHandler(DescType fromType, DescType toType, AECoercionHandlerUPP handler, long handlerRefcon, Boolean fromTypeIsDesc, Boolean isSysHandler)
  772.  THREEWORDINLINE(0x303C, 0x0A22, 0xA816);
  773. extern pascal OSErr AERemoveCoercionHandler(DescType fromType, DescType toType, AECoercionHandlerUPP handler, Boolean isSysHandler)
  774.  THREEWORDINLINE(0x303C, 0x0723, 0xA816);
  775. extern pascal OSErr AEGetCoercionHandler(DescType fromType, DescType toType, AECoercionHandlerUPP *handler, long *handlerRefcon, Boolean *fromTypeIsDesc, Boolean isSysHandler)
  776.  THREEWORDINLINE(0x303C, 0x0B24, 0xA816);
  777.  
  778. /**************************************************************************
  779.   These calls are used to set up and modify special hooks into the
  780.   AppleEvent manager.
  781. **************************************************************************/
  782.  
  783. extern pascal OSErr AEInstallSpecialHandler(AEKeyword functionClass, UniversalProcPtr handler, Boolean isSysHandler)
  784.  THREEWORDINLINE(0x303C, 0x0500, 0xA816);
  785. extern pascal OSErr AERemoveSpecialHandler(AEKeyword functionClass, UniversalProcPtr handler, Boolean isSysHandler)
  786.  THREEWORDINLINE(0x303C, 0x0501, 0xA816);
  787. extern pascal OSErr AEGetSpecialHandler(AEKeyword functionClass, UniversalProcPtr *handler, Boolean isSysHandler)
  788.  THREEWORDINLINE(0x303C, 0x052D, 0xA816);
  789.  
  790. /**************************************************************************
  791.   This call was added in version 1.0.1. If called with the keyword
  792.   keyAERecorderCount ('recr'), the number of recorders that are
  793.   currently active is returned in 'result'.
  794. **************************************************************************/
  795.  
  796.  
  797. /* available only in vers 1.0.1 and greater */
  798.  
  799. extern pascal OSErr AEManagerInfo(AEKeyword keyWord, long *result)
  800.  THREEWORDINLINE(0x303C, 0x0441, 0xA816);
  801. #ifdef __cplusplus
  802. }
  803. #endif
  804.  
  805. #endif
  806.  
  807.